<div th:replace="~{ app :: layout ('重置密码', _, ~{::#main}, _) }" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity6">
    <div id="main" class="container my-2rem">
        <div class="row justify-content-center">
            <div class="col-lg-8">
                <div class="card">
                    <div class="card-header">重置密码</div>

                    <div class="card-body">
                        <div th:if="${error}" class="alert alert-danger"><span th:text="${error}"></span></div>

                        <form method="POST" action="#" th:action="@{/user/do-password-reset}" th:object="${passwordResetDTO}">
                            <input type="hidden" name="token" th:field="*{token}">

                            <div class="row mb-3 justify-content-center">
                                <div class="col-lg-6">
                                    <input placeholder="新密码" id="password" type="password" class="form-control" th:class="|form-control ${#fields.hasErrors('password') ? 'is-invalid' : ''}|" th:field="*{password}" name="password" required autocomplete="password">
                                    <span th:if="${#fields.hasErrors('password')}" class="invalid-feedback" role="alert"><strong th:errors = "*{password}"></strong></span>
                                </div>
                            </div>

                            <div class="row mb-3 justify-content-center">
                                <div class="col-lg-6">
                                    <input placeholder="确认密码" id="confirmPassword" type="password" class="form-control" th:class="|form-control ${#fields.hasErrors('confirmPassword') ? 'is-invalid' : ''}|" th:field="*{confirmPassword}" name="confirmPassword" required>
                                    <span th:if="${#fields.hasErrors('confirmPassword')}" class="invalid-feedback" role="alert"><strong th:errors = "*{confirmPassword}"></strong></span>
                                </div>
                            </div>

                            <div class="row mb-0">
                                <div class="col-lg-6 offset-lg-3">
                                    <button type="submit" class="btn btn-primary">
                                        重置密码
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>